package day6;

import java.util.Scanner;

import org.junit.Test;

public class Demo {
	
	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入运行的第一个数值：");
		int num1 = scanner.nextInt(); 
		System.out.println("请输入要执行的运算：(+ - * / )");
		String ch = scanner.next();
		System.out.println("请输入运行的第二个数值：");
		int num2 = scanner.nextInt(); 
		
		int result;
		System.out.println("结果为：");
			if (ch.equals("+")) {
				result = Add(num1, num2);
				System.out.println(result);
			}else if (ch.equals("-")) {
				result = Sub(num1, num2);
				System.out.println(result);
			}else if (ch.equals("*")) {
				result = Multi(num1, num2);
				System.out.println(result);
			}else if (ch.equals("/")) {
				result = Div(num1, num2);
				System.out.println(result);
			}else {
				System.out.println("输入错误");
			}
			
		
		
	}

	@Test
	public static int Add(int num1,int num2) {
		Add add = new Add(num1,num2);
		int result = add.getResult();
		return result;
		
	}
	
	@Test
	public static int Sub(int num1,int num2) {
		Sub sub = new Sub(num1,num2);
		int result = sub.getResult();
		return result;
	}
	
	@Test
	public static int Multi(int num1,int num2) {
		Multi multi = new Multi(num1,num2);
		int result = multi.getResult();
		return result;
	}

	@Test
	public static int Div(int num1,int num2) {
		Div	div = new Div(num1,num2);
		int result = div.getResult();
		return result;
	}
	
	
}
